package com.sdygmedia.service.impl;

import java.util.Date;
import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sdygmedia.dao.CategoryChildDao;
import com.sdygmedia.domain.CategoryChild;
import com.sdygmedia.service.CategoryChildService;

@Service
@Transactional
public class CategoryChildServiceImpl implements CategoryChildService {

	@Resource
	private CategoryChildDao categoryChildDao;

	@Override
	public List<CategoryChild> findAll() {
		// TODO Auto-generated method stub
		return categoryChildDao.findAll();
	}

	@Override
	public void delete(long id) {
		// TODO Auto-generated method stub
		categoryChildDao.delete(id);
	}

	@Override
	public void save(CategoryChild categoryChild) {
		// TODO Auto-generated method stub
		
		categoryChild.setDate(new Date());
		
		categoryChild.setIsImageList(categoryChild.getCategory().getIsImageList());
		
		categoryChildDao.save(categoryChild);
	}

	@Override
	public CategoryChild getById(long id) {
		// TODO Auto-generated method stub
		return categoryChildDao.getById(id);
	}

	@Override
	public void update(CategoryChild categoryChild) {
		// TODO Auto-generated method stub
		categoryChild.setDate(new Date());
		categoryChildDao.update(categoryChild);
	}
	
}
